﻿using AMAP.Domain;
using AMAP.ServiceClasses.Common;
using AMAP.ServiceInterfaces;
using AMAP.ServiceInterfaces.Common;
using System;
using System.Collections.Generic;
using System.Linq;

namespace AMAP.ServiceClasses
{
    public class OfferService : BaseRepositoryService<Offer>, IOfferService
    {
        public OfferService(IDatabaseFactory databaseFactory)
            : base(databaseFactory)
        {
        }

        public IList<Offer> GetLastValidOffers()
        {
            DateTime Week = DateTime.Now.AddDays(-7);
            return this.dataContext.OfferSet.Where(o => o.CreationDate > Week).ToList<Offer>();
        }
    }
}
